<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    /**
     * 数组 
     * 定义方式 var arr1 =[1, 'b', 3];
     * 定义方式 var arr2 = newArray('a','b','c');
     * 二维数组的定义
     * 属性：length 数组长度可变
    */
    var arr =[1,2,3,4,5];
    console.log(arr.length);
    //遍历数组元素
    for(var i = 0;i<arr.length;i++){
        console.log(arr[i]);
    }
    //数组长度可变
    //js数组可以有动态的数组长度
    var aColors = ["red","yellow","green"];
    alert(aColors.length);
    aColors[3]="purple";//aColors[aColors.length]="purple";
    alert(aColors.length);
    for(var i = 0;i<aColors.length;i++){
        console.log(aColors[i]);
    }
</script>
</html>